/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aice.chinamapview.slice;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import org.junit.Test;
import top.defaults.colorpicker.ScreenUtils;

/**
 * ScreenUtils单元测试
 *
 * @author jjy
 * @since 2021-04-23
 */
public class ScreenUtilsTest {
    private Context context;
    public void initClass() {
        context = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentTopAbility().getContext();
    }

    /**
     * 获取屏幕宽度
     */
    @Test
    public void getScreenWidth() {
        initClass();
        int screenWidth = ScreenUtils.getScreenWidth(context);
        System.out.println("screenWidth-------------------" + screenWidth);
    }

    /**
     * 获取屏幕高度
     */
    @Test
    public void getScreenHeight() {
        initClass();
        int screenHeight = ScreenUtils.getScreenHeight(context);
        System.out.println("screenHeight-------------------" + screenHeight);
    }

    /**
     * 获取屏幕密度
     */
    @Test
    public void getScreenDensityDpi() {
        initClass();
        int screenDensityDpi = ScreenUtils.getScreenDensityDpi(context);
        System.out.println("screenDensityDpi-------------------" + screenDensityDpi);
    }

    /**
     * 获取状态栏高度
     */
    @Test
    public void getStatusHeight() {
        initClass();
        int statusHeight = ScreenUtils.getStatusHeight(context);
        System.out.println("statusHeight-------------------" + statusHeight);
    }

}